<template>
  <view>
    <u-cell-group>
      <u-cell-item title="效果图片" :arrow="false" :border-bottom="false" style="padding-bottom: 0;"></u-cell-item>
      <u-cell-item :arrow="false" style="padding: 10rpx;">
        <image-upload :value="data.EffectList" :readonly="true"></image-upload>
      </u-cell-item>
      <u-cell-item title="实景图片" :arrow="false" :border-bottom="false" style="padding-bottom: 0;"></u-cell-item>
      <u-cell-item :arrow="false" style="padding: 10rpx;">
        <real-image-upload :value="data.RealList" :readonly="true"></real-image-upload>
      </u-cell-item>
      <!-- <u-cell-item
        title="合同盖章版电子文件"
        :arrow="false"
        :border-bottom="false"
        style="padding-bottom: 0;"
      ></u-cell-item>
      <u-cell-item :arrow="false" style="padding: 10rpx;">
        <image-upload :value="data.Contract_PhotoList" :readonly="true"></image-upload>
      </u-cell-item> -->

      <block v-if="countCharacterOccurrences(Account, 'D') < 2">
        <u-cell-item title="分销文件" :arrow="false" :border-bottom="false" style="padding-bottom: 0;"></u-cell-item>
        <u-cell-item :arrow="false" style="padding: 10rpx;">
          <image-upload
            :readonly="true"
            :value="data.Distribution_PhotoList.filter(item => item.TypeId == 1)"
          ></image-upload>
        </u-cell-item>
        <u-cell-item :arrow="false" style="padding: 10rpx;">
          <file-picker
            :readonly="true"
            :value="data.Distribution_PhotoList.filter(item => item.TypeId == 4)"
          ></file-picker>
        </u-cell-item>
      </block>

      <u-cell-item title="精选专卖店" :arrow="false" v-if="showIsExclusive">
        <u-radio-group v-model="data.IsExclusive" :disabled="true">
          <u-radio :name="1">是</u-radio>
          <u-radio :name="2">否</u-radio>
        </u-radio-group>
      </u-cell-item>
      <u-cell-item title="金额" :arrow="false" :value="data.Price == -1 ? '' : data.Price"></u-cell-item>

      <u-cell-item title="支付类型" :arrow="false">
        <u-radio-group :value="data.PayType" :disabled="true">
          <u-radio :name="1">商城支付</u-radio>
          <u-radio :name="2">第三方支付</u-radio>
          <u-radio :name="3">未支付</u-radio>
        </u-radio-group>
      </u-cell-item>

      <block v-if="showReview">
        <u-cell-item
          title="批复金额"
          :arrow="false"
          :value="data.ReplyPrice == -1 ? '' : data.ReplyPrice"
        ></u-cell-item>
        <u-cell-item title="批复日期" :arrow="false" :value="data.ReplyTime | date('yyyy-mm-dd')"></u-cell-item>
        <u-cell-item title="申请备注" :arrow="false">
          <u-input
            placeholder=""
            :value="data.ApplicationRemake"
            type="textarea"
            :disabled="true"
            inputAlign="right"
            value=""
          ></u-input>
        </u-cell-item>
        <u-cell-item title="审核状态" :arrow="false" :value="data.StateName"></u-cell-item>

        <template v-if="showAuditRemark">
          <u-cell-item title="初审备注" :arrow="false" :value="data.FirstAuditNote"></u-cell-item>
          <u-cell-item title="复审备注" :arrow="false" :value="data.ReviewAuditNote"></u-cell-item>
          <u-cell-item title="终审备注" :arrow="false" :value="data.FinalAuditNote"></u-cell-item>
        </template>
      </block>
    </u-cell-group>
  </view>
</template>

<script>
export default {
  name: 'store-renovation-information',
  props: {
    showPayType: {
      type: Boolean,
      default: true
    },
    showIsExclusive: {
      type: Boolean,
      default: true
    },
    showReview: {
      type: Boolean,
      default: true
    },
    showAuditRemark: {
      type: Boolean,
      default: true
    },
    data: {
      type: Object,
      default() {
        return {
          RealList: [],
          EffectList: [],
          Contract_PhotoList: [],
          Distribution_PhotoList: [],
          FirstAuditNote: '',
          ReviewAuditNote: '',
          FinalAuditNote: '',
          StateName: '',
          // 	批复金额 若=-1 赋值空字符串
          ReplyPrice: null,
          // 支付类型
          PayType: 0,
          ReplyTime: null,
          IsExclusive: 0,
          ApplicationRemake: '',
          ApplicationDate: null,
          Account: ''
        };
      }
    }
  },
  data() {
    return {};
  },

  methods: {
    countCharacterOccurrences(str, char) {
      if (!str) {
        return 0;
      }
      // 使用正则表达式匹配字符出现的次数
      const regex = new RegExp(char, 'g');
      const count = (str.match(regex) || []).length;
      return count;
    }
  }
};
</script>

<style lang="scss"></style>
